package cn.victory.planA;

import org.junit.Test;
import redis.clients.jedis.Jedis;

/**
 * @ Description Jedis客户端操作Redis
 *              方式一：最朴素的操作方式
 * @ Author victory
 * @ Date 2022/5/14
 **/
public class JedisDemo {



    /**
     *  1.创建连接
     *  2.操作redis
     *  3.释放链接
     **/
    @Test
    public void testJedis(){
        //1.先创建一个连接
        Jedis jedisConnection = new Jedis("127.0.0.1",6379,3000);
        //2.然后操作redis
        jedisConnection.set("user", "victory");
        String user = jedisConnection.get("user");
        System.out.println(user);
        //3.操作完成后关闭连接
        jedisConnection.close();
    }
}
